<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <script type="text/javascript" src="../../js/boot.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../static/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../static/ueditor.all.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../static/lang/zh-cn/zh-cn.js"></script>
</head>

<body>
    <script id="editor" type="text/plain" style="min-height: 100%;width: 100%;"></script>
</body>

<script type="text/javascript">
    var editor = UE.getEditor('editor', {
        // toolbars: [["fullscreen", "source", "undo", "redo"]],
        toolbars: [[]], // 去掉所有工具栏
        autoHeightEnabled: true,
        autoFloatEnabled: true,
        fullscreen: true
    });

    // 初始化加载正文
    /* editor.ready(function () {
        editor.execCommand('source');
       
    }); */

    function setContent(content) {
        editor.setContent(content);
    }

    // 过一会设置为源码模式
    window.setTimeout(function () {
        editor.execCommand('source');
    }, 500);

    // 过一会设置为源码模式
    window.setTimeout(function () {
        editor.setContent("<p><html><body><title>ddddddd</title></body></html></p>");
    }, 1000);

    /* window.setTimeout(function () {
        debugger
        var parent = window.parent;
        var html = parent.getHtmlCode();
        var code = html.innerHTML;
        // console.log(html);
        
        editor.setContent('<html>\n'+code+"</html>\n");
    }, 1500); */

    // ctrl+S保存事件
    document.onkeydown = function () {
        var oEvent = window.event;
        if (oEvent.keyCode == 83 && oEvent.ctrlKey) {
            alert("你按下了ctrl+S");
            return false;
        }
    }

    // 教程地址：https://ueditor.baidu.com/website/onlinedemo.html
</script>

</html>